package com.finley.flowabledemo.design.state.demo02.source;


import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @description:
 * @author: xianfei.chao
 * @date 2025/6/24 17:09
 * @version: 1.0
 */
public class PaymentProcessor {

    /**
     * amount > 100,返回true, 否则返回false
     * @param items
     * @param amount
     * @return
     */
    public boolean processPayment(List<OrderItem> items, double amount) {
        System.out.println(StrUtil.format("产品ids:[{}], 总金额:[{}]",
                items.stream().map(OrderItem::getProductId).collect(Collectors.joining(",")), amount));
        return NumberUtil.sub(amount, 100) > 0;
    }
}
